package com.neteast.androidclient.contact.domain;

import java.io.Serializable;
import java.util.ArrayList;

import android.util.Log;
public class Contact implements Serializable,Cloneable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 5475171262495082675L;
	//本用户的id，用于服务器
	public int ownId;
	//云好友的id，用户服务器。注，当ownId=contactId时，意味着本人修改自己在服务器上的信息
	public int contactId;
	public String localId;
	public String displayName;
	public String fphone;
	public String femail;
	public String organization;
	public String job;
	public String photo;
	//姓名的拼音首字母
	public char sortKey;
	public boolean hasPhoto=false;
	public boolean isReadOnly=false;
	public boolean isDelete =false;
	
	public String groups;
	
	public ArrayList<ContactData> phones=new ArrayList<ContactData>();
	public ArrayList<ContactData> emails=new ArrayList<ContactData>();
	public ArrayList<ContactData> ims=new ArrayList<ContactData>();
	public ArrayList<ContactData> locations=new ArrayList<ContactData>();
	
	public String remark;
	public String state;
	
	@SuppressWarnings("unchecked")
	@Override
	public Contact clone(){
		try {
			Contact contact=(Contact) super.clone();
			contact.phones=(ArrayList<ContactData>) phones.clone();
			contact.emails=(ArrayList<ContactData>) emails.clone();
			contact.ims=(ArrayList<ContactData>) ims.clone();
			contact.locations=(ArrayList<ContactData>) locations.clone();
			return contact;
		} catch (CloneNotSupportedException e) {
			Log.e("test", e.getMessage(),e);
			throw new RuntimeException("对象克隆失败");
		}
	}

	
	@Override
	public String toString() {
		return "Contact [ownId=" + ownId + ", contactId=" + contactId
				+ ", localId=" + localId + ", displayName=" + displayName
				+ ", fphone=" + fphone + ", femail=" + femail
				+ ", organization=" + organization + ", job=" + job
				+ ", photo=" + photo + ", sortKey=" + Character.toString(sortKey) + ", hasPhoto="
				+ hasPhoto + ", isReadOnly=" + isReadOnly + ", groups="
				+ groups + ", phones=" + phones + ", emails=" + emails
				+ ", ims=" + ims + ", locations=" + locations + "]";
	}


	public void clear() {
		phones.clear();
		emails.clear();
		ims.clear();
		locations.clear();
	}
}
